/**
 * ajax登陆验证函数
 * @returns {Boolean}
 */
function loginValidate(){
	var username = trim($("#username").val());
	var password = $("#password").val();
	var flag = false;
	
	if (username == "") {
		$("#username").focus();
		$("#validMsg").text("用户名不能为空");
		return false;
	} else if (password == ""){
		$("#password").focus();
		$("#validMsg").text("密码不能为空");
		return false;
	}else {
		$.ajax({
			async : false,
			url : "loginValidate",
			type : "post",
			data : {username:username,password:password},
			dataType : "json",
			success : function(result){
				if(result.success == true){
					if(result.data.msg == "RIGHT"){
						flag = true;
					}else if(result.data.msg == "ERROR"){
						$("#validMsg").text("用户名或密码错误");
					}else if(result.data.msg == "FREEZE"){
						$("#validMsg").text("帐号已被冻结");
					}
				}
			}
		});
		return flag;
	}
}